package demoMod.stsconsole.powers;

import demoMod.stsconsole.core.AbstractCreature;
import demoMod.stsconsole.dungeons.AbstractDungeon;
import demoMod.stsconsole.interfaces.ISubscriber;
import demoMod.stsconsole.interfaces.MonsterDeathSubscriber;
import demoMod.stsconsole.monsters.AbstractMonster;

public class SporeCloudPower extends AbstractPower implements MonsterDeathSubscriber {
    public static final String ID = "SporeCloudPower";

    public SporeCloudPower(AbstractCreature owner, int amount) {
        super(ID, owner, amount);
    }

    @Override
    public String getUpdatedDescriptions() {
        return String.format(this.description, this.amount[0]);
    }

    @Override
    public void onMonsterDeath(AbstractMonster monster) {
        if (monster == this.owner) {
            AbstractDungeon.player.applyPower(this.owner, new VulnerablePower(AbstractDungeon.player, this.amount[0]));
        }
    }

    @Override
    public boolean enabled(Class<? extends ISubscriber> cls) {
        return this.owner != null && !this.isDone;
    }
}
